package yui.bss.demo.utils;

import org.apache.commons.codec.binary.Base64;

public class Base64Utils {
    public static final Base64 base64 = new Base64();
    public static String decrypt(String text) {
        try {
            return new String(base64.decode(text), "UTF-8");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return text;
    }

    public static String encrypt(String text) {
        try {
            byte[] textByte = text.getBytes("UTF-8");
            return base64.encodeToString(textByte);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return text;
    }

}
